package github.fafaovo.common.enchantment;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentType;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.inventory.EquipmentSlotType;

public class ExampleEnchantment extends Enchantment {
    //Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType[] slots
    //稀有度  附魔类型  持有位置
    private static final EquipmentSlotType[] M = new EquipmentSlotType[]{
            EquipmentSlotType.FEET,
            EquipmentSlotType.LEGS,
            EquipmentSlotType.CHEST,
            EquipmentSlotType.HEAD
    };
    public ExampleEnchantment() {
        //稀有度普通 附魔到装备上
        super(Rarity.COMMON,EnchantmentType.ARMOR,M);
    }

    public int getMinEnchantability(int enchantmentLevel) {
        //最小附魔等级
        return 1 + 10 * (enchantmentLevel - 1); //附魔属性的等级
    }

    public int getMaxEnchantability(int enchantmentLevel) {
        //最大附魔等级
        return super.getMinEnchantability(enchantmentLevel) + 50;
    }

    /**
     * Returns the maximum level that the enchantment can have.
     */
    public int getMaxLevel() {
        return 5;
    }

    @Override
    protected boolean canApplyTogether(Enchantment ench) {
        return super.canApplyTogether(ench);
    }
}
